﻿using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;

namespace ZYing.QPanel
{
    public class QPanelModule : IModule
    {
        public void OnInitialized(IContainerProvider containerProvider)
        {
            var region = containerProvider.Resolve<IRegionManager>();
            region.RegisterViewWithRegion(Constants.RegionConstants.MainRegion, typeof(Views.Scheduler).FullName);
            ViewModels.LogsViewModel.Start();
        }

        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            Register<Views.Scheduler>(containerRegistry);
            Register<Views.Jobs>(containerRegistry);
            Register<Views.Triggers>(containerRegistry);
            Register<Views.Executions>(containerRegistry);
            Register<Views.History>(containerRegistry);
            Register<Views.HistoryDetail>(containerRegistry);
            Register<Views.Logs>(containerRegistry);
        }
        private static void Register<T>(IContainerRegistry registry)
        {
            registry.RegisterForNavigation(typeof(T), typeof(T).FullName);
        }
    }
}
